UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1NDa0s3j11DqxEHe1YNV7/96ESTp+kmn5o1H73Yjq5Q=' 
WHERE 
  key_id = '263fcccd5fd775c9db76dd67fd20054a0e27880395bb535d8f03a4813560f3c4' 
  AND (
    token = '1NDa0s3j11DqxEHe1YNV7/96ESTp+kmn5o1H73Yjq5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032