UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oOsDhqg8GxwK52/S2DkvNnMTtiQNx9ylCOzo3QTr7TU=' 
WHERE 
  key_id = '1a305677f4d96b8e9b2654c06fb19951aec0c0f73325982862b4a5aa57c870f8' 
  AND (
    token = 'oOsDhqg8GxwK52/S2DkvNnMTtiQNx9ylCOzo3QTr7TU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021