UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nNtqaatOKKIYMuTo2zl+p6KwjnQOeSeRv+rmqewSGY4='
WHERE
key_id = 'fd0da9903125b51db9a7e50f4ec51d237cefb88388ea8a4708df7b7e59003fd1'
AND (
token = 'nNtqaatOKKIYMuTo2zl+p6KwjnQOeSeRv+rmqewSGY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)