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

Query time 0.00023