UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gqOeRJxe7yIT9K5Xgmon++1n0HuxZsNVMf47q4FBRc4='
WHERE
key_id = 'be9a1686f2da620f2ceb3be58fa980ebd70db2f4dd83637d6daeda6d99097a85'
AND (
token = 'gqOeRJxe7yIT9K5Xgmon++1n0HuxZsNVMf47q4FBRc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)