UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JAPMytzCksecmZjwRMIe3yeUJgpC5LEJ61dBX2szLcc='
WHERE
key_id = '8584ac3ba17a250411d5be2ff71200eb5d3d32f94373dae092073571b6e89726'
AND (
token = 'JAPMytzCksecmZjwRMIe3yeUJgpC5LEJ61dBX2szLcc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)