UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pZbOyDdgXyM40UKdNyWFu03qeszpb+BAKAzQpx4eIMY='
WHERE
key_id = 'bba45fa6bd99a0f597f9fa911f5862b88b456a7d353f548822d3eb75ed139c3e'
AND (
token = 'pZbOyDdgXyM40UKdNyWFu03qeszpb+BAKAzQpx4eIMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)