UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZwgiA53utIuLKiTBb5w3dtObIjpsU7JqcYXdSNpnCdk='
WHERE
key_id = '65e9e059903910ae689284488ca05ec86cca3e315a6d15b7b403dc36343f43f5'
AND (
token = 'ZwgiA53utIuLKiTBb5w3dtObIjpsU7JqcYXdSNpnCdk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)