UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K+1miqhEGdznm8j9QWGd4u7KUziH3glsrZvmQONig1E='
WHERE
key_id = '2d342c360db23ef0dc29bbc60cd121136d8cf7346294814d07d82f92aed979cf'
AND (
token = 'K+1miqhEGdznm8j9QWGd4u7KUziH3glsrZvmQONig1E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)