UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iRLxysqsMc8SadwCW59VhON9O34uzuFKVKiFMmkWjoA='
WHERE
key_id = '22c9182927724ce357263280df8c88ab05b6e6c84e2975124db17216191c30a6'
AND (
token = 'iRLxysqsMc8SadwCW59VhON9O34uzuFKVKiFMmkWjoA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)