UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'atxis5wmxW/ZmW2aC2YLhyLjoYeN55w1BwyI2n6iD+A='
WHERE
key_id = '686ffa18352c2c76522a85f2d59d0b1ed21c4cca89f819b7ba24425175ef44c4'
AND (
token = 'atxis5wmxW/ZmW2aC2YLhyLjoYeN55w1BwyI2n6iD+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)