UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z464CphB54iGXA9COkzN5LM5czo1Slq65O/pi39XXO4=' 
WHERE 
  key_id = '9fad7a06c15e6fcaae84ae03554c951be083818ee23c5947f271f96df31c2c7e' 
  AND (
    token = 'Z464CphB54iGXA9COkzN5LM5czo1Slq65O/pi39XXO4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052