UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aWdYPcZJ702db3JI6XAvtzJVUoAtVcQGPV+uJYKsFWY='
WHERE
key_id = 'c3ae4d411b04b48812faa637b2bd7112877a397acc84321e1a6c9af77dd99692'
AND (
token = 'aWdYPcZJ702db3JI6XAvtzJVUoAtVcQGPV+uJYKsFWY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)