UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i6ZHeyJ5EfixbXsEe8xQ15gfB7QB/EDYCEe4Y6Tv15Q='
WHERE
key_id = 'df31ac73437928965f063e0f8f50ba3d7ca76d5a9e74d42707d62b80c7d98fb2'
AND (
token = 'i6ZHeyJ5EfixbXsEe8xQ15gfB7QB/EDYCEe4Y6Tv15Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)