UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KRGuFMYZ7JMfRAkca9BTCWX9L2BspNeBZU7zJxFPSEY='
WHERE
key_id = 'be094c42449f094b1681fb797be4467cc20555848ab5ee9ea259a9fe47b0603b'
AND (
token = 'KRGuFMYZ7JMfRAkca9BTCWX9L2BspNeBZU7zJxFPSEY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)