UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OFG297o3hmws2k/7E6Pv8U2vJGm++tN6vSc+30FBReg=' 
WHERE 
  key_id = 'd51ad71c7a897b9e2527249f2d394ebe25c5de4b820a5d84bc35fcdf100fbd9b' 
  AND (
    token = 'OFG297o3hmws2k/7E6Pv8U2vJGm++tN6vSc+30FBReg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044