UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7VJUPPWhd7W1GNH3kWk5SXMnai4vHXH2na5dbQ4wrq0='
WHERE
key_id = 'c192aa17821c534d419391241f0bb0a6762f6c3d78164c8665484d1584591742'
AND (
token = '7VJUPPWhd7W1GNH3kWk5SXMnai4vHXH2na5dbQ4wrq0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)