UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3KAw12/evUGnbWmc40iEGw0aXncySNi2uUuQqRfFm/4='
WHERE
key_id = 'c21b3bdc21687c81a05e629a593c200d35e7a5872f2e23705148288270c4c3a2'
AND (
token = '3KAw12/evUGnbWmc40iEGw0aXncySNi2uUuQqRfFm/4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)