UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kRe8msNKDQSFFFmG/NAoylgeV7sgftWCcLCMWgoxBTA='
WHERE
key_id = 'ce1dadd4dd4c590b6648506fdacc539e372b4e0168e737ca98022459e84e91ec'
AND (
token = 'kRe8msNKDQSFFFmG/NAoylgeV7sgftWCcLCMWgoxBTA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)