UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3TM2s1euHtyNwrHgDfqz6XpsM58AhfYYqONHbUiqkMo='
WHERE
key_id = '3b034a02fb1b53bd25a4f29630aa60c8002ef795d3f94a1129044771a120ba54'
AND (
token = '3TM2s1euHtyNwrHgDfqz6XpsM58AhfYYqONHbUiqkMo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)