UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g1UaixnhliAnS8lLPnPKe7W0+W/Qgd2c3O9zaxCBSHw='
WHERE
key_id = '31c9268d09fc41aed68108551175af11749618d9be0e0daf32e73a2b2dc85134'
AND (
token = 'g1UaixnhliAnS8lLPnPKe7W0+W/Qgd2c3O9zaxCBSHw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)