UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zJDCQVNTsLn9WkCm9XvpRtKOwW2nl7r6XWAfet7VMQ8='
WHERE
key_id = 'b5e6a9db5c4c0335b4b87323ab29077b7172efe7468103a0ad02b3149526c97d'
AND (
token = 'zJDCQVNTsLn9WkCm9XvpRtKOwW2nl7r6XWAfet7VMQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)