UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3EHMcsajSDhkFceZOtRQYZw9ILHwbQbXMMG5TZcZYoI='
WHERE
key_id = 'bfbf92836481d9de1a205088e949260b040f93fe22176295be5a9654800dcde8'
AND (
token = '3EHMcsajSDhkFceZOtRQYZw9ILHwbQbXMMG5TZcZYoI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)