UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UH/piHsPONjQq2q0c3uNSPN7SKwoAzXHD5VVPMy2+gE='
WHERE
key_id = 'ff10cfaccffa2c5966f01e5539e8bb5678d3c5e30dc3b695ce56f1992ea3bf75'
AND (
token = 'UH/piHsPONjQq2q0c3uNSPN7SKwoAzXHD5VVPMy2+gE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)