UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6DdnHoWZGOk6BhqwiqjOFLcs0pFo0VyFUA+/aflmfP4=' 
WHERE 
  key_id = '1bca7067c244fab075e88faf4fc9888e7641e1d2848820aa8c24933e2053f930' 
  AND (
    token = '6DdnHoWZGOk6BhqwiqjOFLcs0pFo0VyFUA+/aflmfP4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032