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