UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w1CcLIQCaIFIPWJOhsR8FctcAxuW+NLoOjsJNzl2rOY='
WHERE
key_id = 'b972dad0ac5f5f0ab4c2d70dfb2b0a3dec74e0e4ce826587773a84c902415175'
AND (
token = 'w1CcLIQCaIFIPWJOhsR8FctcAxuW+NLoOjsJNzl2rOY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)