UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uXb+477TuqOOTtBZ3+/BQKhE3+mrIVxngTBDbbuX3Rs='
WHERE
key_id = 'e3ff6c66393f0739ed83cc561569d9f44062fe8eee9f70c0488e690b2ba8d081'
AND (
token = 'uXb+477TuqOOTtBZ3+/BQKhE3+mrIVxngTBDbbuX3Rs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)