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