UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6KF5bhv7SXIJrXHlJWzi2LEpcQlSJDiCBaW9rRpPU+k='
WHERE
key_id = 'ecd01ddefbef0602147029ab57f48049ca85c6e887eba8a7b1bbed6c2b986ce4'
AND (
token = '6KF5bhv7SXIJrXHlJWzi2LEpcQlSJDiCBaW9rRpPU+k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)