UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LhsfRd012G5F4PzVHMs7cjQDfQvFVPQsD+1BvIesXC8='
WHERE
key_id = 'e06401d1cfccd0a36ab18e568ca6cabce38e730c67e76ae9205d1eb05f4ee422'
AND (
token = 'LhsfRd012G5F4PzVHMs7cjQDfQvFVPQsD+1BvIesXC8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)