UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '22nnAUBGCKepN4AXbnSKOqYWbgPaepwsCYlYkP1R+cQ='
WHERE
key_id = '3041168b8a4fdf41a6ad8698f55f7f93c38511c2d539be9e6c53153d8986a954'
AND (
token = '22nnAUBGCKepN4AXbnSKOqYWbgPaepwsCYlYkP1R+cQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)