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