UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v9EXW8E0OXSAFESZ6fUg701PpvRUQ6UNgEd0gcxt4PI='
WHERE
key_id = '06c3bf7bdf887719d530d569ba851430e7ac437f7bc89377a384d5e52defb8fe'
AND (
token = 'v9EXW8E0OXSAFESZ6fUg701PpvRUQ6UNgEd0gcxt4PI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)